/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Carito
 */
@Entity
@Table(name = "VIDEO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Video.findAll", query = "SELECT v FROM Video v"),
    @NamedQuery(name = "Video.findById", query = "SELECT v FROM Video v WHERE v.videoPK.id = :id"),
    @NamedQuery(name = "Video.findByNombre", query = "SELECT v FROM Video v WHERE v.nombre = :nombre"),
    @NamedQuery(name = "Video.findByLugar", query = "SELECT v FROM Video v WHERE v.lugar = :lugar"),
    @NamedQuery(name = "Video.findByFecha", query = "SELECT v FROM Video v WHERE v.fecha = :fecha"),
    @NamedQuery(name = "Video.findByHorainicio", query = "SELECT v FROM Video v WHERE v.horainicio = :horainicio"),
    @NamedQuery(name = "Video.findByHorafin", query = "SELECT v FROM Video v WHERE v.horafin = :horafin"),
    @NamedQuery(name = "Video.findByDuracion", query = "SELECT v FROM Video v WHERE v.duracion = :duracion"),
    @NamedQuery(name = "Video.findByTamano", query = "SELECT v FROM Video v WHERE v.tamano = :tamano"),
    @NamedQuery(name = "Video.findByAutor", query = "SELECT v FROM Video v WHERE v.autor = :autor"),
    @NamedQuery(name = "Video.findByCiudad", query = "SELECT v FROM Video v WHERE v.ciudad = :ciudad"),
    @NamedQuery(name = "Video.findByInscripcion", query = "SELECT v FROM Video v WHERE v.inscripcion = :inscripcion"),
    @NamedQuery(name = "Video.findByTipo", query = "SELECT v FROM Video v WHERE v.tipo = :tipo"),
    @NamedQuery(name = "Video.findByIddato", query = "SELECT v FROM Video v WHERE v.videoPK.iddato = :iddato")})
public class Video implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected VideoPK videoPK;
    @Size(max = 150)
    @Column(name = "NOMBRE")
    private String nombre;
    @Size(max = 150)
    @Column(name = "LUGAR")
    private String lugar;
    @Column(name = "FECHA")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "HORAINICIO")
    @Temporal(TemporalType.DATE)
    private Date horainicio;
    @Column(name = "HORAFIN")
    @Temporal(TemporalType.DATE)
    private Date horafin;
    @Column(name = "DURACION")
    private BigInteger duracion;
    @Column(name = "TAMANO")
    private BigInteger tamano;
    @Size(max = 150)
    @Column(name = "AUTOR")
    private String autor;
    @Size(max = 150)
    @Column(name = "CIUDAD")
    private String ciudad;
    @Size(max = 150)
    @Column(name = "INSCRIPCION")
    private String inscripcion;
    @Size(max = 150)
    @Column(name = "TIPO")
    private String tipo;
    @JoinColumn(name = "IDDATO", referencedColumnName = "IDDATO", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Dato dato;

    public Video() {
    }

    public Video(VideoPK videoPK) {
        this.videoPK = videoPK;
    }

    public Video(BigInteger id, BigInteger iddato) {
        this.videoPK = new VideoPK(id, iddato);
    }

    @XmlElement
    public VideoPK getVideoPK() {
        return videoPK;
    }

    public void setVideoPK(VideoPK videoPK) {
        this.videoPK = videoPK;
    }

    @XmlElement
    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlElement
    public String getLugar() {
        return lugar;
    }

    public void setLugar(String lugar) {
        this.lugar = lugar;
    }

    @XmlElement
    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    @XmlElement
    public Date getHorainicio() {
        return horainicio;
    }

    public void setHorainicio(Date horainicio) {
        this.horainicio = horainicio;
    }

    @XmlElement
    public Date getHorafin() {
        return horafin;
    }

    public void setHorafin(Date horafin) {
        this.horafin = horafin;
    }

    @XmlElement
    public BigInteger getDuracion() {
        return duracion;
    }

    public void setDuracion(BigInteger duracion) {
        this.duracion = duracion;
    }

    @XmlElement
    public BigInteger getTamano() {
        return tamano;
    }

    public void setTamano(BigInteger tamano) {
        this.tamano = tamano;
    }

    @XmlElement
    public String getAutor() {
        return autor;
    }

    public void setAutor(String autor) {
        this.autor = autor;
    }

    @XmlElement
    public String getCiudad() {
        return ciudad;
    }

    public void setCiudad(String ciudad) {
        this.ciudad = ciudad;
    }

    @XmlElement
    public String getInscripcion() {
        return inscripcion;
    }

    public void setInscripcion(String inscripcion) {
        this.inscripcion = inscripcion;
    }

    @XmlElement
    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    @XmlElement
    public Dato getDato() {
        return dato;
    }

    public void setDato(Dato dato) {
        this.dato = dato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (videoPK != null ? videoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Video)) {
            return false;
        }
        Video other = (Video) object;
        if ((this.videoPK == null && other.videoPK != null) || (this.videoPK != null && !this.videoPK.equals(other.videoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Video[ videoPK=" + videoPK + " ]";
    }
    
}
